package ve.ejb.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author memozac
 */
@Entity
public class PersonCluster implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long idPersonCluster;

    @ManyToOne
    @JoinColumn(name="idPerson",nullable=false,updatable=true)
    private Person person;

    @ManyToOne
    @JoinColumn(name="idCluster",nullable=false,updatable=true)
    private Cluster cluster;

    @Temporal(value = TemporalType.TIMESTAMP) private Date registerDate;

    public Date getRegisterDate() {
        return registerDate;
    }

    public void setRegisterDate(Date registerDate) {
        this.registerDate = registerDate;
    }

    public Cluster getCluster() {
        return cluster;
    }

    public void setCluster(Cluster cluster) {
        this.cluster = cluster;
    }

    public Long getIdPersonCluster() {
        return idPersonCluster;
    }

    public void setIdPersonCluster(Long idPersonCluster) {
        this.idPersonCluster = idPersonCluster;
    }

    public Person getPerson() {
        return person;
    }

    public void setPerson(Person person) {
        this.person = person;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idPersonCluster != null ? idPersonCluster.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof PersonCluster)) {
            return false;
        }
        PersonCluster other = (PersonCluster) object;
        if ((this.idPersonCluster == null && other.idPersonCluster != null) || (this.idPersonCluster != null && !this.idPersonCluster.equals(other.idPersonCluster))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ve.ejb.entity.PersonCluster[id=" + idPersonCluster + "]";
    }

}//ends of class
